/*     */ import java.awt.Color;
/*     */ import java.awt.Container;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Font;
/*     */ import java.awt.Graphics;
/*     */ import java.awt.Graphics2D;
/*     */ import java.awt.Insets;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.awt.event.ItemEvent;
/*     */ import java.awt.event.ItemListener;
/*     */ import java.awt.event.MouseEvent;
/*     */ import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
/*     */ import java.awt.geom.Line2D.Double;
/*     */ import java.text.DecimalFormat;
/*     */ import java.util.List;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.Box;
/*     */ import javax.swing.BoxLayout;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JCheckBox;
/*     */ import javax.swing.JDialog;
/*     */ import javax.swing.JFrame;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JOptionPane;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
/*     */ 
/*     */ public class VolumeChart extends JPanel
/*     */   implements MouseMotionListener, ActionListener, ItemListener
/*     */ {
/*     */   private SymQuotes sq;
/*     */   private String sym;
/*  14 */   private float yScale = 1.0F;
/*  15 */   private float xScale = 1.0F;
/*     */   private double stickWidth;
/*     */   private double minVal;
/*     */   private double maxVal;
/*     */   private double hY;
/*  19 */   private String m = "";
/*     */   private int mX;
/*     */   private int mY;
/*     */   private int parm1;
/*     */   private int parm2;
/*     */   private float[] ma_parm1;
/*     */   private float[] ma_parm2;
/*     */   private float[] MA20;
/*     */   private float[] MA30;
/*     */   private float[] MA50;
/*  28 */   private boolean drawMa20 = true;
/*  29 */   private boolean drawMa30 = true;
/*  30 */   private boolean drawMa50 = true;
/*     */ 
/*  32 */   public int noOfDays = 150;
/*     */   private double p1Yp;
/*     */   private double p2Yp;
/*     */   private double p1Yq;
/*     */   private double p2Yq;
/*     */   private JTextField parm1TF;
/*     */   private JTextField parm2TF;
/*     */   private JButton chgParmOk;
/*     */   private JButton chgParmCancel;
/*     */   private JButton defaultParms;
/*     */   private JDialog chgParmDialog;
/*     */   private JCheckBox ma20CB;
/*     */   private JCheckBox ma30CB;
/*     */   private JCheckBox ma50CB;
/*     */   public VolumeChart.EastPanel ep;
/*     */   private double refY;
/*     */   private double refX;
/* 485 */   private Font ssp10 = new Font("SansSerif", 0, 10);
/* 486 */   private Font ssp9 = new Font("SansSerif", 0, 9);
/* 487 */   private Line2D.Double refL1 = new Line2D.Double();
/* 488 */   private Line2D.Double refL2 = new Line2D.Double();
/* 489 */   private Line2D.Double gridY = new Line2D.Double();
/* 490 */   private DecimalFormat df = new DecimalFormat();
/* 491 */   private Line2D.Double yrefL1 = new Line2D.Double();
/* 492 */   private Line2D.Double yrefL2 = new Line2D.Double();
/* 493 */   private Line2D.Double gridX = new Line2D.Double();
/*     */   private double yfactor;
/*     */   private double startPointX;
/*     */   private int dateRef;
/*     */   private int daysRef;
/* 498 */   private Line2D.Double hL = new Line2D.Double();
/* 499 */   private Line2D.Double l2 = new Line2D.Double();
/*     */ 
/*     */   public VolumeChart(SymQuotes paramSymQuotes, int paramInt1, int paramInt2)
/*     */   {
/*  48 */     this.sq = paramSymQuotes;
/*  49 */     this.sym = paramSymQuotes.sym;
/*     */ 
/*  51 */     this.parm1 = paramInt1;
/*  52 */     this.parm2 = paramInt2;
/*     */ 
/*  54 */     this.ma_parm1 = MAnFinder(paramInt1);
/*  55 */     this.ma_parm2 = MAnFinder(paramInt2);
/*  56 */     this.MA20 = MAnFinder(20);
/*  57 */     this.MA30 = MAnFinder(30);
/*  58 */     this.MA50 = MAnFinder(50);
/*     */ 
/*  60 */     if (this.noOfDays == 150)
/*  61 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/*  63 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/*  65 */     setBackground(Color.black);
/*  66 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */ 
/*  70 */     this.minVal = 0.0D;
/*     */ 
/*  72 */     findMax();
/*  73 */     addMouseMotionListener(this);
/*     */ 
/*  75 */     this.ep = new VolumeChart.EastPanel();
/*     */   }
/*     */ 
/*     */   public void changeNoOfDays(int paramInt)
/*     */   {
/*  82 */     this.noOfDays = paramInt;
/*     */ 
/*  84 */     if (paramInt == 150)
/*  85 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/*  87 */       this.stickWidth = (1.5D * this.xScale);
/*  88 */     findMax();
/*     */   }
/*     */ 
/*     */   public void redrawChart(SymQuotes paramSymQuotes)
/*     */   {
/*  95 */     this.sq = paramSymQuotes;
/*  96 */     this.sym = paramSymQuotes.sym;
/*     */ 
/*  98 */     this.ma_parm1 = MAnFinder(this.parm1);
/*  99 */     this.ma_parm2 = MAnFinder(this.parm2);
/* 100 */     this.MA20 = MAnFinder(20);
/* 101 */     this.MA30 = MAnFinder(30);
/* 102 */     this.MA50 = MAnFinder(50);
/*     */ 
/* 104 */     if (this.noOfDays == 150)
/* 105 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/* 107 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/* 109 */     findMax();
/*     */ 
/* 111 */     repaint();
/* 112 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void redrawChart()
/*     */   {
/* 119 */     this.ma_parm1 = MAnFinder(this.parm1);
/* 120 */     this.ma_parm2 = MAnFinder(this.parm2);
/*     */ 
/* 122 */     findMax();
/*     */ 
/* 124 */     repaint();
/* 125 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   private float[] MAnFinder(int paramInt)
/*     */   {
/* 132 */     float[] arrayOfFloat = new float[this.sq.count];
/*     */ 
/* 134 */     for (int i = paramInt; i < this.sq.count; i++)
/*     */     {
/* 136 */       float f = 0.0F;
/* 137 */       for (int j = i; j >= i - (paramInt - 1); j--)
/*     */       {
/* 139 */         f += ((Integer)this.sq.qty.get(j)).intValue();
/*     */       }
/*     */ 
/* 142 */       arrayOfFloat[i] = (f / paramInt);
/*     */     }
/*     */ 
/* 146 */     return arrayOfFloat;
/*     */   }
/*     */ 
/*     */   public void mouseMoved(MouseEvent paramMouseEvent)
/*     */   {
/* 154 */     int j = 1;
/* 155 */     if ((paramMouseEvent.getX() >= 50) && (paramMouseEvent.getX() <= 750.0F * this.xScale + 50.0F) && (paramMouseEvent.getY() >= 10) && (paramMouseEvent.getY() <= this.yScale * 100.0F + 10.0F))
/*     */     {
/* 157 */       int i = (int)((750.0F * this.xScale - (paramMouseEvent.getX() - 50) - this.stickWidth / 2.0D) / (this.stickWidth + 1.0F * this.xScale));
/*     */ 
/* 159 */       if (this.sq.count - 1 >= i) {
/* 160 */         j = this.sq.count - 1 - i;
/*     */ 
/* 162 */         if (this.sq.sd.equals("noSplit"))
/*     */         {
/* 164 */           this.m = ("(" + (String)this.sq.date.get(j) + ", Vol:" + this.sq.qty.get(j) + ")");
/*     */         }
/* 167 */         else if (j < this.sq.date.indexOf(this.sq.sd))
/*     */         {
/* 169 */           float f = this.sq.asq / this.sq.bsq;
/* 170 */           this.m = ("(" + (String)this.sq.date.get(j) + ", Vol:" + (int)(((Integer)this.sq.qty.get(j)).intValue() / f) + ")");
/*     */         }
/*     */         else
/*     */         {
/* 174 */           this.m = ("(" + (String)this.sq.date.get(j) + ", Vol:" + this.sq.qty.get(j) + ")");
/*     */         }
/*     */ 
/* 180 */         this.mX = paramMouseEvent.getX();
/* 181 */         this.mY = paramMouseEvent.getY();
/* 182 */         repaint();
/* 183 */         return;
/*     */       }
/*     */ 
/* 186 */       this.m = "";
/* 187 */       repaint();
/* 188 */       return;
/*     */     }
/*     */ 
/* 192 */     this.m = "";
/* 193 */     repaint();
/*     */   }
/*     */ 
/*     */   public void mouseDragged(MouseEvent paramMouseEvent)
/*     */   {
/*     */   }
/*     */ 
/*     */   private void drawValues(Graphics2D paramGraphics2D)
/*     */   {
/* 206 */     paramGraphics2D.setPaint(Color.cyan);
/*     */ 
/* 208 */     if (this.mX + this.m.length() * 5 > 750.0F * this.xScale + 50.0F) {
/* 209 */       this.mX -= this.m.length() * 5;
/*     */     }
/* 211 */     paramGraphics2D.drawString(this.m, this.mX, this.mY);
/*     */   }
/*     */ 
/*     */   public Box getVolumeBox(boolean paramBoolean1, boolean paramBoolean2)
/*     */   {
/* 218 */     Box localBox = Box.createHorizontalBox();
/* 219 */     TitledBorder localTitledBorder = BorderFactory.createTitledBorder("Volume");
/*     */ 
/* 221 */     this.parm1TF = new JTextField("" + this.parm1, 2);
/* 222 */     this.parm2TF = new JTextField("" + this.parm2, 2);
/* 223 */     this.parm1TF.setFont(this.ssp10);
/* 224 */     this.parm2TF.setFont(this.ssp10);
/* 225 */     this.parm1TF.setMaximumSize(new Dimension(25, 20));
/* 226 */     this.parm2TF.setMaximumSize(new Dimension(25, 20));
/*     */ 
/* 228 */     JLabel localJLabel1 = new JLabel("Vol. MA[");
/* 229 */     JLabel localJLabel2 = new JLabel("], Vol. MA[");
/* 230 */     JLabel localJLabel3 = new JLabel("]  ");
/*     */ 
/* 232 */     localJLabel1.setFont(this.ssp10);
/* 233 */     localJLabel2.setFont(this.ssp10);
/* 234 */     localJLabel3.setFont(this.ssp10);
/*     */ 
/* 236 */     this.ma20CB = new JCheckBox("MA[20]", this.drawMa20);
/* 237 */     this.ma30CB = new JCheckBox("MA[30]", this.drawMa30);
/* 238 */     this.ma50CB = new JCheckBox("MA[50]", this.drawMa50);
/* 239 */     this.ma20CB.setFont(this.ssp10);
/* 240 */     this.ma30CB.setFont(this.ssp10);
/* 241 */     this.ma50CB.setFont(this.ssp10);
/* 242 */     this.ma20CB.addItemListener(this);
/* 243 */     this.ma30CB.addItemListener(this);
/* 244 */     this.ma50CB.addItemListener(this);
/*     */ 
/* 246 */     localBox.add(localJLabel1);
/* 247 */     localBox.add(this.parm1TF);
/* 248 */     localBox.add(localJLabel2);
/* 249 */     localBox.add(this.parm2TF);
/* 250 */     localBox.add(localJLabel3);
/*     */ 
/* 252 */     if (paramBoolean2) {
/* 253 */       localBox.add(this.ma20CB);
/* 254 */       localBox.add(this.ma30CB);
/* 255 */       localBox.add(this.ma50CB);
/*     */     }
/*     */ 
/* 258 */     localBox.add(Box.createHorizontalGlue());
/*     */ 
/* 260 */     if (paramBoolean1) {
/* 261 */       localBox.setBorder(localTitledBorder);
/*     */     }
/* 263 */     return localBox;
/*     */   }
/*     */ 
/*     */   public void showChgParmDialog()
/*     */   {
/* 270 */     JFrame localJFrame = new JFrame();
/* 271 */     this.chgParmDialog = new JDialog(localJFrame, "Change Vol. MA", true);
/* 272 */     Box localBox1 = Box.createVerticalBox();
/* 273 */     Box localBox2 = Box.createHorizontalBox();
/*     */ 
/* 275 */     this.chgParmOk = new JButton("OK");
/* 276 */     this.chgParmOk.setFont(this.ssp10);
/* 277 */     this.chgParmOk.setMargin(new Insets(1, 2, 1, 2));
/* 278 */     this.chgParmOk.addActionListener(this);
/*     */ 
/* 280 */     this.chgParmCancel = new JButton("Cancel");
/* 281 */     this.chgParmCancel.setFont(this.ssp10);
/* 282 */     this.chgParmCancel.setMargin(new Insets(1, 2, 1, 2));
/* 283 */     this.chgParmCancel.addActionListener(this);
/*     */ 
/* 285 */     this.defaultParms = new JButton("Default");
/* 286 */     this.defaultParms.setFont(this.ssp10);
/* 287 */     this.defaultParms.setMargin(new Insets(1, 2, 1, 2));
/* 288 */     this.defaultParms.setToolTipText("Reset to default MAs");
/* 289 */     this.defaultParms.addActionListener(this);
/*     */ 
/* 291 */     localBox2.add(Box.createHorizontalGlue());
/* 292 */     localBox2.add(this.chgParmOk);
/* 293 */     localBox2.add(Box.createHorizontalStrut(5));
/* 294 */     localBox2.add(this.chgParmCancel);
/* 295 */     localBox2.add(Box.createHorizontalStrut(5));
/* 296 */     localBox2.add(this.defaultParms);
/* 297 */     localBox2.add(Box.createHorizontalGlue());
/*     */ 
/* 299 */     localBox1.add(getVolumeBox(true, true));
/* 300 */     localBox1.add(localBox2);
/*     */ 
/* 302 */     this.chgParmDialog.getContentPane().add(localBox1);
/* 303 */     this.chgParmDialog.setSize(350, 110);
/* 304 */     this.chgParmDialog.setLocationRelativeTo(this.ep);
/* 305 */     this.chgParmDialog.setVisible(true);
/*     */   }
/*     */ 
/*     */   public boolean validateParm()
/*     */   {
/* 312 */     int i = this.parm1;
/* 313 */     int j = this.parm2;
/*     */     try
/*     */     {
/* 317 */       i = Integer.parseInt(this.parm1TF.getText().trim());
/* 318 */       j = Integer.parseInt(this.parm2TF.getText().trim());
/*     */     }
/*     */     catch (NumberFormatException localNumberFormatException)
/*     */     {
/* 324 */       JOptionPane.showMessageDialog(null, "Error in Volume parameter.Enter only numbers greater than 2.", null, 0);
/*     */ 
/* 327 */       this.parm1TF.setText("" + this.parm1);
/* 328 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 330 */       return false;
/*     */     }
/*     */ 
/* 334 */     if ((i > 200) || (j > 200))
/*     */     {
/* 336 */       JOptionPane.showMessageDialog(null, "Error in Volume parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 339 */       this.parm1TF.setText("" + this.parm1);
/* 340 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 342 */       return false;
/*     */     }
/*     */ 
/* 346 */     if ((i < 2) || (j < 2))
/*     */     {
/* 348 */       JOptionPane.showMessageDialog(null, "Error in Volume parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 351 */       this.parm1TF.setText("" + this.parm1);
/* 352 */       this.parm2TF.setText("" + this.parm2);
/*     */ 
/* 354 */       return false;
/*     */     }
/*     */ 
/* 358 */     this.parm1 = i;
/* 359 */     this.parm2 = j;
/*     */ 
/* 361 */     return true;
/*     */   }
/*     */ 
/*     */   public void actionPerformed(ActionEvent paramActionEvent)
/*     */   {
/* 368 */     if (paramActionEvent.getSource() == this.chgParmOk)
/*     */     {
/* 370 */       if (!validateParm()) {
/* 371 */         return;
/*     */       }
/* 373 */       redrawChart();
/* 374 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 378 */     if (paramActionEvent.getSource() == this.chgParmCancel)
/*     */     {
/* 380 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 384 */     if (paramActionEvent.getSource() == this.defaultParms)
/*     */     {
/* 386 */       setDefaultParms();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setDefaultParms()
/*     */   {
/* 395 */     this.parm1TF.setText("5");
/* 396 */     this.parm2TF.setText("10");
/*     */   }
/*     */ 
/*     */   public void itemStateChanged(ItemEvent paramItemEvent)
/*     */   {
/* 403 */     if (paramItemEvent.getSource() == this.ma20CB)
/*     */     {
/* 405 */       this.drawMa20 = this.ma20CB.isSelected();
/*     */     }
/*     */ 
/* 409 */     if (paramItemEvent.getSource() == this.ma30CB)
/*     */     {
/* 411 */       this.drawMa30 = this.ma30CB.isSelected();
/*     */     }
/*     */ 
/* 415 */     if (paramItemEvent.getSource() == this.ma50CB)
/*     */     {
/* 417 */       this.drawMa50 = this.ma50CB.isSelected();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void vZoom(boolean paramBoolean)
/*     */   {
/* 426 */     if (paramBoolean)
/* 427 */       this.yScale += 0.2F;
/* 428 */     else if (this.yScale >= 1.2F) {
/* 429 */       this.yScale -= 0.2F;
/*     */     }
/* 431 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void hZoom(boolean paramBoolean)
/*     */   {
/* 438 */     if (paramBoolean)
/* 439 */       this.xScale += 0.2F;
/* 440 */     else if (this.xScale >= 1.2F) {
/* 441 */       this.xScale -= 0.2F;
/*     */     }
/* 443 */     if (this.noOfDays == 150)
/* 444 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 446 */       this.stickWidth = (1.5D * this.xScale);
/* 447 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void resetZoom()
/*     */   {
/* 454 */     this.yScale = 1.0F;
/* 455 */     this.xScale = 1.0F;
/* 456 */     if (this.noOfDays == 150)
/* 457 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 459 */       this.stickWidth = (1.5D * this.xScale);
/* 460 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   protected void clear(Graphics paramGraphics)
/*     */   {
/* 468 */     super.paintComponent(paramGraphics);
/*     */   }
/*     */ 
/*     */   protected void paintComponent(Graphics paramGraphics)
/*     */   {
/* 475 */     clear(paramGraphics);
/* 476 */     Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
/* 477 */     drawChart(localGraphics2D);
/* 478 */     drawValues(localGraphics2D);
/*     */   }
/*     */ 
/*     */   private void drawChart(Graphics2D paramGraphics2D)
/*     */   {
/* 504 */     this.refY = 10.0D;
/* 505 */     this.refX = 50.0D;
/* 506 */     setFont(this.ssp10);
/* 507 */     String str = "Volume";
/* 508 */     paramGraphics2D.setPaint(new Color(100, 240, 250));
/* 509 */     paramGraphics2D.drawString(str, 50, 10);
/*     */ 
/* 511 */     str = "MA[" + this.parm1 + "]";
/* 512 */     paramGraphics2D.setPaint(new Color(220, 170, 40));
/* 513 */     paramGraphics2D.drawString(str, 100, 10);
/* 514 */     str = "MA[" + this.parm2 + "]";
/* 515 */     paramGraphics2D.setPaint(new Color(190, 100, 200));
/* 516 */     paramGraphics2D.drawString(str, 135, 10);
/*     */ 
/* 518 */     str = "MA[20]";
/* 519 */     paramGraphics2D.setPaint(new Color(160, 160, 10));
/* 520 */     if (this.drawMa20) {
/* 521 */       paramGraphics2D.drawString(str, 175, 10);
/*     */     }
/* 523 */     str = "MA[30]";
/* 524 */     paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 525 */     if (this.drawMa30) {
/* 526 */       paramGraphics2D.drawString(str, 215, 10);
/*     */     }
/* 528 */     str = "MA[50]";
/* 529 */     paramGraphics2D.setPaint(new Color(10, 100, 210));
/* 530 */     if (this.drawMa50) {
/* 531 */       paramGraphics2D.drawString(str, 255, 10);
/*     */     }
/*     */ 
/* 534 */     this.refL1.setLine(50.0D, 10.0D, 50.0D, this.yScale * 100.0F + 10.0F);
/* 535 */     this.refL2.setLine(750.0F * this.xScale + 50.0F, 10.0D, 750.0F * this.xScale + 50.0F, this.yScale * 100.0F + 10.0F);
/* 536 */     paramGraphics2D.setPaint(Color.white);
/* 537 */     paramGraphics2D.draw(this.refL1);
/* 538 */     paramGraphics2D.draw(this.refL2);
/*     */ 
/* 540 */     for (int i = 0; i < 14; i++)
/*     */     {
/* 542 */       this.refX += 50.0F * this.xScale;
/* 543 */       this.gridY.setLine(this.refX, 10.0D, this.refX, this.yScale * 100.0F + 10.0F);
/* 544 */       paramGraphics2D.setPaint(Color.darkGray);
/* 545 */       paramGraphics2D.draw(this.gridY);
/*     */     }
/*     */ 
/* 549 */     this.df.applyPattern("0.00E00");
int i;
/*     */ 
/* 551 */     for (i = 0; i < 11; i++)
/*     */     {
/* 553 */       this.yrefL1.setLine(50.0D, this.refY, 40.0D, this.refY);
/* 554 */       if (this.maxVal > 99999.0D)
/* 555 */         str = this.df.format(this.maxVal - (this.maxVal - this.minVal) / 10.0D * i);
/*     */       else {
/* 557 */         str = "" + (int)(this.maxVal - (this.maxVal - this.minVal) / 10.0D * i);
/*     */       }
/* 559 */       paramGraphics2D.setPaint(Color.lightGray);
/* 560 */       paramGraphics2D.drawString(str, 5, (int)this.refY);
/* 561 */       this.yrefL2.setLine(750.0F * this.xScale + 50.0F, this.refY, 750.0F * this.xScale + 60.0F, this.refY);
/*     */ 
/* 563 */       paramGraphics2D.drawString(str, (int)(750.0F * this.xScale + 51.0F), (int)this.refY);
/* 564 */       this.gridX.setLine(50.0D, this.refY, 750.0F * this.xScale + 50.0F, this.refY);
/* 565 */       paramGraphics2D.setPaint(Color.white);
/* 566 */       paramGraphics2D.draw(this.yrefL1);
/* 567 */       paramGraphics2D.draw(this.yrefL2);
/* 568 */       paramGraphics2D.setPaint(Color.darkGray);
/* 569 */       paramGraphics2D.draw(this.gridX);
/* 570 */       this.refY += 10.0F * this.yScale;
/*     */     }
/*     */ 
/* 574 */     this.yfactor = (this.yScale * 100.0F / (this.maxVal - this.minVal));
/* 575 */     this.startPointX = (750.0F * this.xScale + 50.0F - (this.stickWidth + 1.0F * this.xScale));
/* 576 */     this.dateRef = (this.sq.count - 1);
/* 577 */     this.daysRef = 1;
/*     */ 
/* 579 */     for (i = this.sq.count - 1; i >= 0; i--)
/*     */     {
/* 581 */       if (this.daysRef == this.noOfDays) {
/*     */         break;
/*     */       }
/* 584 */       this.hY = (this.yScale * 100.0F + 10.0F - (((Integer)this.sq.qty.get(i)).intValue() - this.minVal) * this.yfactor);
/* 585 */       this.hL.setLine(this.startPointX, this.yScale * 100.0F + 10.0F, this.startPointX, this.hY);
/*     */ 
/* 588 */       if (i > 0) {
/* 589 */         if (((Float)this.sq.close.get(i)).floatValue() - ((Float)this.sq.close.get(i - 1)).floatValue() >= 0.0F)
/* 590 */           paramGraphics2D.setPaint(Color.green);
/*     */         else
/* 592 */           paramGraphics2D.setPaint(Color.red);
/*     */       }
/* 594 */       else paramGraphics2D.setPaint(Color.green);
/*     */ 
/* 596 */       paramGraphics2D.draw(this.hL);
/*     */ 
/* 599 */       if (this.dateRef == i)
/*     */       {
/* 601 */         paramGraphics2D.setFont(this.ssp9);
/* 602 */         str = ((String)this.sq.date.get(i)).substring(0, 6);
/* 603 */         paramGraphics2D.drawString(str, (int)this.startPointX, (int)(this.yScale * 100.0F + 20.0F));
/* 604 */         if (this.noOfDays == 150)
/* 605 */           this.dateRef -= 10;
/*     */         else
/* 607 */           this.dateRef -= 20;
/* 608 */         paramGraphics2D.setFont(this.ssp10);
/*     */       }
/*     */ 
/* 613 */       if (i > 5)
/*     */       {
/* 615 */         this.p1Yq = (this.yScale * 100.0F + 10.0F - (this.ma_parm1[i] - this.minVal) * this.yfactor);
/* 616 */         this.p2Yq = (this.yScale * 100.0F + 10.0F - (this.ma_parm1[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 618 */         this.l2.setLine(this.startPointX, this.p1Yq, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Yq);
/* 619 */         paramGraphics2D.setPaint(new Color(220, 170, 40));
/* 620 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 624 */       if (i > 10)
/*     */       {
/* 626 */         this.p1Yq = (this.yScale * 100.0F + 10.0F - (this.ma_parm2[i] - this.minVal) * this.yfactor);
/* 627 */         this.p2Yq = (this.yScale * 100.0F + 10.0F - (this.ma_parm2[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 629 */         this.l2.setLine(this.startPointX, this.p1Yq, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Yq);
/* 630 */         paramGraphics2D.setPaint(new Color(190, 100, 200));
/* 631 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 635 */       if ((this.drawMa20) && (i > 20))
/*     */       {
/* 637 */         this.p1Yq = (this.yScale * 100.0F + 10.0F - (this.MA20[i] - this.minVal) * this.yfactor);
/* 638 */         this.p2Yq = (this.yScale * 100.0F + 10.0F - (this.MA20[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 640 */         this.l2.setLine(this.startPointX, this.p1Yq, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Yq);
/* 641 */         paramGraphics2D.setPaint(new Color(160, 160, 10));
/* 642 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 646 */       if ((this.drawMa30) && (i > 30))
/*     */       {
/* 648 */         this.p1Yq = (this.yScale * 100.0F + 10.0F - (this.MA30[i] - this.minVal) * this.yfactor);
/* 649 */         this.p2Yq = (this.yScale * 100.0F + 10.0F - (this.MA30[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 651 */         this.l2.setLine(this.startPointX, this.p1Yq, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Yq);
/* 652 */         paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 653 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 657 */       if ((this.drawMa50) && (i > 50))
/*     */       {
/* 659 */         this.p1Yq = (this.yScale * 100.0F + 10.0F - (this.MA50[i] - this.minVal) * this.yfactor);
/* 660 */         this.p2Yq = (this.yScale * 100.0F + 10.0F - (this.MA50[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 662 */         this.l2.setLine(this.startPointX, this.p1Yq, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Yq);
/* 663 */         paramGraphics2D.setPaint(new Color(10, 100, 210));
/* 664 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 669 */       this.startPointX = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 670 */       this.daysRef += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   private void findMax()
/*     */   {
/* 680 */     int i = 1;
/* 681 */     this.maxVal = ((Integer)this.sq.qty.get(this.sq.count - 1)).intValue();
/*     */ 
/* 683 */     for (int j = this.sq.count - 1; j >= 0; j--)
/*     */     {
/* 685 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 688 */       if (this.maxVal < ((Integer)this.sq.qty.get(j)).intValue()) {
/* 689 */         this.maxVal = ((Integer)this.sq.qty.get(j)).intValue();
/*     */       }
/* 691 */       i += 1;
/*     */     }
/*     */ 
/* 695 */     i = 1;
int j;
/* 696 */     for (j = this.sq.count - 1; j >= 5; j--)
/*     */     {
/* 698 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 701 */       if (this.maxVal < this.ma_parm1[j]) {
/* 702 */         this.maxVal = this.ma_parm1[j];
/*     */       }
/* 704 */       i += 1;
/*     */     }
/*     */ 
/* 708 */     i = 1;
/* 709 */     for (j = this.sq.count - 1; j >= 10; j--)
/*     */     {
/* 711 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 714 */       if (this.maxVal < this.ma_parm2[j]) {
/* 715 */         this.maxVal = this.ma_parm2[j];
/*     */       }
/* 717 */       i += 1;
/*     */     }
/*     */ 
/* 721 */     i = 1;
/* 722 */     for (j = this.sq.count - 1; j >= 20; j--)
/*     */     {
/* 724 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 727 */       if (this.maxVal < this.MA20[j]) {
/* 728 */         this.maxVal = this.MA20[j];
/*     */       }
/* 730 */       i += 1;
/*     */     }
/*     */ 
/* 734 */     i = 1;
/* 735 */     for (j = this.sq.count - 1; j >= 30; j--)
/*     */     {
/* 737 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 740 */       if (this.maxVal < this.MA30[j]) {
/* 741 */         this.maxVal = this.MA30[j];
/*     */       }
/* 743 */       i += 1;
/*     */     }
/*     */ 
/* 747 */     i = 1;
/* 748 */     for (j = this.sq.count - 1; j >= 50; j--)
/*     */     {
/* 750 */       if (i > this.noOfDays) {
/*     */         break;
/*     */       }
/* 753 */       if (this.maxVal < this.MA50[j]) {
/* 754 */         this.maxVal = this.MA50[j];
/*     */       }
/* 756 */       i += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] paramArrayOfString)
/*     */   {
/* 858 */     FileDownloader localFileDownloader = new FileDownloader();
/* 859 */     localFileDownloader.downloadFiles();
/* 860 */     SymQuotes localSymQuotes = new SymQuotes("WIPRO", localFileDownloader.datesToRead, 1, 1, "ns");
/*     */ 
/* 862 */     VolumeChart localVolumeChart = new VolumeChart(localSymQuotes, 5, 10);
/*     */ 
/* 864 */     JFrame localJFrame = new JFrame("Test");
/* 865 */     localJFrame.setDefaultCloseOperation(3);
/* 866 */     localJFrame.getContentPane().add(localVolumeChart);
/* 867 */     localJFrame.pack();
/* 868 */     localJFrame.setSize(850, 170);
/* 869 */     localJFrame.setVisible(true);
/*     */   }
/*     */ 
/*     */   public class EastPanel extends JPanel
/*     */     implements ActionListener
/*     */   {
/*     */     private JLabel title;
/*     */     private JLabel ma_parm1L;
/*     */     private JLabel ma_parm2L;
/*     */     private JLabel ma20L;
/*     */     private JLabel ma30L;
/*     */     private JLabel ma50L;
/*     */     private ChartHelpButton chb;
/* 769 */     private Font valuesF = new Font("Sanserif", 0, 11);
/*     */     private JButton chgParmButton;
/* 771 */     private Box buttonsPanel = Box.createHorizontalBox();
/*     */ 
/*     */     public EastPanel()
/*     */     {
/* 775 */       this.title = new JLabel("Volume: " + VolumeChart.this.sq.qty.get(VolumeChart.this.sq.count - 1));
/* 776 */       this.ma_parm1L = new JLabel("MA[" + VolumeChart.this.parm1 + "]: " + (int)VolumeChart.this.ma_parm1[(VolumeChart.this.sq.count - 1)]);
/* 777 */       this.ma_parm2L = new JLabel("MA[" + VolumeChart.this.parm2 + "]: " + (int)VolumeChart.this.ma_parm2[(VolumeChart.this.sq.count - 1)]);
/* 778 */       this.ma20L = new JLabel("MA[20]: " + (int)VolumeChart.this.MA20[(VolumeChart.this.sq.count - 1)]);
/* 779 */       this.ma30L = new JLabel("MA[30]: " + (int)VolumeChart.this.MA30[(VolumeChart.this.sq.count - 1)]);
/* 780 */       this.ma50L = new JLabel("MA[50]: " + (int)VolumeChart.this.MA50[(VolumeChart.this.sq.count - 1)]);
/*     */ 
/* 782 */       this.chb = new ChartHelpButton("http://www.profitindicators.com/home/indicators/volumecharts.htm", "Help on Volume Charts");
/*     */ 
/* 784 */       this.chb.setFont(this.valuesF);
/*     */ 
/* 786 */       this.ma_parm1L.setFont(this.valuesF);
/* 787 */       this.ma_parm2L.setFont(this.valuesF);
/* 788 */       this.ma20L.setFont(this.valuesF);
/* 789 */       this.ma30L.setFont(this.valuesF);
/* 790 */       this.ma50L.setFont(this.valuesF);
/*     */ 
/* 792 */       this.chgParmButton = new JButton("Chg.Parm.");
/* 793 */       this.chgParmButton.setFont(this.valuesF);
/* 794 */       this.chgParmButton.setMargin(new Insets(1, 2, 1, 2));
/* 795 */       this.chgParmButton.addActionListener(this);
/* 796 */       this.chgParmButton.setToolTipText("Change Volume MAs");
/*     */ 
/* 798 */       this.buttonsPanel.add(this.chb);
/* 799 */       this.buttonsPanel.add(Box.createHorizontalStrut(2));
/* 800 */       this.buttonsPanel.add(this.chgParmButton);
/* 801 */       this.buttonsPanel.setAlignmentX(0.0F);
/*     */ 
/* 803 */       setLayout(new BoxLayout(this, 3));
/*     */ 
/* 805 */       add(this.title);
/* 806 */       add(this.ma_parm1L);
/* 807 */       add(this.ma_parm2L);
/* 808 */       add(this.ma20L);
/* 809 */       add(this.ma30L);
/* 810 */       add(this.ma50L);
/* 811 */       add(new JLabel(" "));
/* 812 */       add(this.buttonsPanel);
/* 813 */       add(Box.createVerticalGlue());
/*     */ 
/* 815 */       setBackground(new Color(243, 245, 252));
/*     */     }
/*     */ 
/*     */     public void updateValues()
/*     */     {
/* 821 */       this.title.setText("Volume: " + VolumeChart.this.sq.qty.get(VolumeChart.this.sq.count - 1));
/* 822 */       this.ma_parm1L.setText("MA[" + VolumeChart.this.parm1 + "]: " + (int)VolumeChart.this.ma_parm1[(VolumeChart.this.sq.count - 1)]);
/* 823 */       this.ma_parm2L.setText("MA[" + VolumeChart.this.parm2 + "]: " + (int)VolumeChart.this.ma_parm2[(VolumeChart.this.sq.count - 1)]);
/*     */ 
/* 825 */       if (VolumeChart.this.drawMa20)
/* 826 */         this.ma20L.setText("MA[20]: " + (int)VolumeChart.this.MA20[(VolumeChart.this.sq.count - 1)]);
/*     */       else {
/* 828 */         this.ma20L.setText(" ");
/*     */       }
/* 830 */       if (VolumeChart.this.drawMa30)
/* 831 */         this.ma30L.setText("MA[30]: " + (int)VolumeChart.this.MA30[(VolumeChart.this.sq.count - 1)]);
/*     */       else {
/* 833 */         this.ma30L.setText(" ");
/*     */       }
/* 835 */       if (VolumeChart.this.drawMa50)
/* 836 */         this.ma50L.setText("MA[50]: " + (int)VolumeChart.this.MA50[(VolumeChart.this.sq.count - 1)]);
/*     */       else
/* 838 */         this.ma50L.setText(" ");
/*     */     }
/*     */ 
/*     */     public void actionPerformed(ActionEvent paramActionEvent)
/*     */     {
/* 844 */       if (paramActionEvent.getSource() == this.chgParmButton)
/*     */       {
/* 846 */         VolumeChart.this.showChgParmDialog();
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Deebak\Downloads\profitindicatorsv2-05.jar
 * Qualified Name:     VolumeChart
 * JD-Core Version:    0.6.0
 */